package com.icode.core.dto.user;

import com.icode.core.model.user.User;
import org.hibernate.validator.constraints.Length;

/**
 * Created with IntelliJ IDEA.
 * User: lb
 * Date: 15-12-11
 * Time: 下午2:02
 * To change this template use File | Settings | File Templates.
 */
public class PasswordHandelDTO {
    private String password;
    @Length(min = 6, max = 6, message = "请输入6位密码!")
    private String newPassword;
    private String reNewPassword;
    private String userName;
    private String validationNum;

    public PasswordHandelDTO() {

    }
    public PasswordHandelDTO(String userName) {
       this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getNewPassword() {
        return newPassword;
    }

    public void setNewPassword(String newPassword) {
        this.newPassword = newPassword;
    }

    public String getReNewPassword() {
        return reNewPassword;
    }

    public void setReNewPassword(String reNewPassword) {
        this.reNewPassword = reNewPassword;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getValidationNum() {
        return validationNum;
    }

    public void setValidationNum(String validationNum) {
        this.validationNum = validationNum;
    }

    public static PasswordHandelDTO toDTO(User user) {
        String userName = user.getUsername();
        PasswordHandelDTO passwordHandelDTO = new PasswordHandelDTO(userName);
        return passwordHandelDTO;
    }
}
